package com.superteam.zzl.model.DynamicFragment;

import com.superteam.zzl.activity.R;
import com.superteam.zzl.app.MyApplication;
import com.superteam.zzl.cans.Url;
import com.superteam.zzl.retrofit.DynamicFragment.IDynamicFragmentRetrofit;

import retrofit2.Callback;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;

/**
 * Created by Administrator on 2017/1/10.
 */

public class MDynamic {
    private Callback callback;

    public MDynamic(Callback callback) {
        this.callback = callback;
    }

    public void loadData() {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("http://www.qiugonglue.com/")
                .addConverterFactory(ScalarsConverterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        IDynamicFragmentRetrofit iDynamicFragment = retrofit.create(IDynamicFragmentRetrofit.class);
        iDynamicFragment.getAll(Url.All).enqueue(callback);
        iDynamicFragment.getAll(Url.Help).enqueue(callback);
        iDynamicFragment.getAll(Url.With).enqueue(callback);
        iDynamicFragment.getAll(Url.CarSharing).enqueue(callback);
        iDynamicFragment.getAll(Url.Travel).enqueue(callback);
    }

    public String[] getTitles() {
        return MyApplication.context.getResources().getStringArray(R.array.dynamics);
    }


}
